//
//  AppDelegate.m
//  极客闪讯
//
//  Created by LIMING on 14-10-15.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "AppDelegate.h"
#import "InfoViewController.h"
#import "BbsViewController.h"
#import "PhotoViewController.h"
#import "UserViewController.h"
#import "SearchViewController.h"
@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    
    //资讯的根视图与导航控制器
    InfoViewController *vc1 = [[InfoViewController alloc]init];
    UINavigationController *nav1 = [[UINavigationController alloc]initWithRootViewController:vc1];
    nav1.navigationBar.translucent = NO;
    nav1.navigationBar.barTintColor= [UIColor blackColor];//设定navigationbar背景颜色
    [nav1.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIFont fontWithName:@"Arial" size:20] forKey:NSFontAttributeName]];//修改title字体大小
    [nav1.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]];//修改title字体颜色
    nav1.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"资讯" image:[UIImage imageNamed:@"Bar1.png"] tag:1];
    //[self.window setRootViewController:nav1];
    [vc1 release];
    
    
    
    BbsViewController *vc2 = [[BbsViewController alloc]init];
    UINavigationController *nav2 = [[UINavigationController alloc]initWithRootViewController:vc2];
    nav2.navigationBar.translucent = NO;
    nav2.navigationBar.barTintColor= [UIColor blackColor];//设定navigationbar背景颜色
    [nav2.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIFont fontWithName:@"Arial" size:20] forKey:NSFontAttributeName]];//修改title字体大小
    [nav2.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]];//修改title字体颜色
    nav2.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"论坛" image:[UIImage imageNamed:@"Bar2.png"] tag:2];
    [vc2 release];

    
    
    SearchViewController *vc3 = [[SearchViewController alloc]init];
    UINavigationController *nav3 = [[UINavigationController alloc]initWithRootViewController:vc3];
    nav3.navigationBar.translucent = NO;
    nav3.navigationBar.barTintColor= [UIColor blackColor];//设定navigationbar背景颜色
    [nav3.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIFont fontWithName:@"Arial" size:20] forKey:NSFontAttributeName]];//修改title字体大小
    [nav3.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]];//修改title字体颜色
    nav3.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"搜索" image:[UIImage imageNamed:@"Bar3.png"] tag:1];
    [vc3 release];
  
    
    
    PhotoViewController *vc4 = [[PhotoViewController alloc]init];
    UINavigationController *nav4 = [[UINavigationController alloc]initWithRootViewController:vc4];
    nav4.navigationBar.translucent = NO;
    nav4.navigationBar.barTintColor= [UIColor blackColor];//设定navigationbar背景颜色
    [nav4.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIFont fontWithName:@"Arial" size:20] forKey:NSFontAttributeName]];//修改title字体大小
    [nav4.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]];//修改title字体颜色
    nav4.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"图搜" image:[UIImage imageNamed:@"Bar4.png"] tag:1];
    [vc4 release];
    
    
    UserViewController *vc5 = [[UserViewController alloc]init];
    UINavigationController *nav5 = [[UINavigationController alloc]initWithRootViewController:vc5];
    nav5.navigationBar.translucent = NO;
    nav5.navigationBar.barTintColor= [UIColor blackColor];//设定navigationbar背景颜色
    [nav5.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIFont fontWithName:@"Arial" size:20] forKey:NSFontAttributeName]];//修改title字体大小
    [nav5.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]];//修改title字体颜色
    nav5.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"用户" image:[UIImage imageNamed:@"Bar5.png"] tag:1];
    [vc5 release];
    
    
    UITabBarController *tabBarController = [[UITabBarController alloc] init];
    tabBarController.tabBar.tintColor = [UIColor redColor];
    tabBarController.tabBar.barTintColor = [UIColor whiteColor];
    tabBarController.viewControllers = [NSArray arrayWithObjects:nav1, nav2, nav3, nav4, nav5, nil];
    self.window.rootViewController = tabBarController;
    [tabBarController release];
    
    
    [nav1 release];
    [nav2 release];
    [nav3 release];
    [nav4 release];
    [nav5 release];
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

@end
